package com.ly.count.impl.room;
 
import com.ly.count.impl.room.transfer.CPlusRoomTransfer;
import com.ly.count.room.mapper.CPlusRoomMapper;
import com.ly.count.room.param.CPlusRoomPage;
import com.ly.count.room.po.CPlusRoom;
import com.ly.count.service.room.CPlusRoomService;
import com.ly.count.http.CPlusResponse;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ly.count.utils.ResponseModelUtils;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
/**
 * Module: CPlusRoom.java
 * 
 * @author liaoyong
 * @since JDK 1.8
 * @version 1.0
 * @date 2024-10-03
 * @Descriptions:
 */
@Service("cPlusRoomService")
public class CPlusRoomServiceImpl extends ServiceImpl<CPlusRoomMapper, CPlusRoom> implements CPlusRoomService {

 	public CPlusResponse<CPlusRoom> selectOne(CPlusRoom cPlusRoom){
 		Wrapper<CPlusRoom> queryWrapper = new QueryWrapper<>(cPlusRoom);

		return ResponseModelUtils.body(getOne(queryWrapper));
 	
 	}
	
	public CPlusResponse<Object>	add(CPlusRoom cPlusRoom) {
		boolean result = save(cPlusRoom);
		if (result) {
			return ResponseModelUtils.success();
		}
		return ResponseModelUtils.fail();
	}
	public CPlusResponse<Object> modify(CPlusRoom cPlusRoom){
		
		boolean result = updateById(cPlusRoom);
		if(result) {
			return ResponseModelUtils.success();
		}
		return ResponseModelUtils.fail();
	}
	
	public CPlusResponse<Page<CPlusRoom>> pageList(CPlusRoomPage cPlusRoomPage){
		Page<CPlusRoom>  page = CPlusRoomTransfer.toPage(cPlusRoomPage);
		return ResponseModelUtils.body(page(page,new QueryWrapper<CPlusRoom>()));
	}

}
